//concat(arr1,arr2...) 合并数组

//every(ck)  所有的都为真返回true

//some（ck）  只有一个为true就返回true

//filter(ck)  返回值为数组

//forEach(ck)

// let arr = [1,2,3];

// let obj = {name:'lili'};

// arr.forEach(function(item){
//     console.log(this);
// },obj)

//map 有返回值 return

// Array.isArray() 是否为数组  false、true

//slice(startInd,endInd=this.length) //不包括最后一个  

//es6数组的扩展

//copyWithin(target,startInd,endInd)

//功能：

let arr = ['a','b','c','d'];

console.log(arr.copyWithin(1,-2,-1)); //['a','d','c','d']

console.log(arr);

//Array.from(类数组,?ck)

//类数组 ：length

let lis = Array.from(document.querySelectorAll('li'),(item) => {
    return item.innerHTML
})

console.log(lis);

let json = {
    'name':'lili',
    'age':'10',
    length:2
};

console.log(Array.from(json));

//Array.of()

console.log(Array.of(1,2,3,4,5))

//Array()

//[10]

console.log(Array.of(10))

//扩展运算符  ...

let arr1 =[1,2,3];
let arr2 = [4,5,6];

let arr3 = [...arr1,...arr2];

console.log(arr3)

let arr5 = [...arr1];

arr5[3] = 9;

console.log(arr1,arr5)

//fill(str,?startIndex,?endIndex) 填充  //会改变原数组

console.log(arr1.fill('@',1,2));
console.log(arr1);


//flat(?num) //拉平数组

let arr8 = [1,2,[3,[4,5]]];

console.log(arr8.flat(2))
console.log(arr8);

let arr11 = ['item1','item2','item3','item4','item5'];

let arr12 = [
    {
        content:'section1',
        index:0
    },
    {
        content:'selection2',
        index:2
    }
];

// function injectSection(arr1,arr2){
//     arr1.forEach((item,ind) => {
//         if(arr2[ind]){
//             arr1[arr2[ind].index] = [arr2[ind].content,arr1[arr2[ind].index]]
//         }  
//     })
    
//     return arr1.flat()
// }

// console.log(injectSection(arr11,arr12));

//Array.prototype.find(ck) 

//功能:查找第一个匹配项并返回

// let newItem = ;
// console.log(arr11);
// console.log(arr11.findIndex(item => item === 'item1'))

//includes true false

// console.log(arr11.includes('item1',1))

console.log(arr11.keys())  //iterator遍历器  for...of 

// keys values entries

// for(let i of arr11.entries()){
//     console.log(i);
// }

let keys = arr11.keys();

console.log(keys.next());
console.log(keys.next());
console.log(keys.next());
console.log(keys.next());
console.log(keys.next());
console.log(keys.next());

//set map
let s = new Set([1,2,3,4,5,5,5,5]);

// s.add(1);
// s.add(1);

for(let z of s){
    console.log(z);
}

let m = new Map();
let o = {p:'hello world'};

m.set(o,'content');

console.log(m.get(o));

console.log(m.has(o));

m.delete(o)

console.log(m.has(o));














